package com.yanze;

import com.github.pagehelper.PageHelper;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.domain.EntityScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import tk.mybatis.spring.annotation.MapperScan;

import java.util.Properties;

@SpringBootApplication
//扫描mybatis mapper包路径
//@EnableJpaRepositories("com.example.repository")//那些搜索不到的JPA相关的实体及Repository的包路径
//@EntityScan("com.example.repository")
//@EntityScan("com.github.pagehelper")
@MapperScan(basePackages = "com.yanze.mapper")
@ComponentScan(basePackages = {"com.yanze", "org.n3r.idworker"})
public class SchoolInformationApplication {

	public static void main(String[] args) {
		SpringApplication.run(SchoolInformationApplication.class, args);
	}

	@Bean
	public PageHelper pageHelper() {
		System.out.println("MyBatisConfiguration.pageHelper()");
		PageHelper pageHelper = new PageHelper();
		Properties p = new Properties();
		p.setProperty("offsetAsPageNum", "true");
		p.setProperty("rowBoundsWithCount", "true");
		p.setProperty("reasonable", "true");
		pageHelper.setProperties(p);
		return pageHelper;
	}
}
